/* 基础样式与重置 */
@font-face {
    font-family: 'mplus_hzk_12';
    src: url('fonts/mplus_hzk_12.ttf') format('truetype');
    font-weight: normal;
    font-style: normal;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'mplus_hzk_12', 'Press Start 2P', cursive;
}

body {
    background-color: #0a0a0a;
    color: #fff;
    overflow: hidden;
    height: 100vh;
}

/* 编辑器容器 */
#editor-container {
    position: relative;
    width: 100vw;
    height: 100vh;
    display: flex;
    flex-direction: column;
}

/* 顶部菜单栏 */
#menu-bar {
    background-color: #1a1a1a;
    border-bottom: 2px solid #333;
    padding: 0.5rem;
    display: flex;
    gap: 1rem;
}

.menu-item {
    position: relative;
    padding: 0.5rem 1rem;
    cursor: pointer;
    color: #fff;
    transition: all 0.3s ease;
}

.menu-item:hover {
    background-color: #333;
    color: #ff4d4d;
}

.submenu {
    position: absolute;
    top: 100%;
    left: 0;
    background-color: #1a1a1a;
    border: 2px solid #333;
    display: none;
    min-width: 150px;
    z-index: 100;
}

.menu-item:hover .submenu {
    display: block;
}

.submenu button {
    width: 100%;
    padding: 0.5rem;
    text-align: left;
    background-color: transparent;
    border: none;
    color: #fff;
    cursor: pointer;
    transition: all 0.3s ease;
}

.submenu button:hover {
    background-color: #333;
    color: #ff4d4d;
}

/* 主编辑区域 */
#main-area {
    display: flex;
    flex: 1;
    overflow: hidden;
}

/* 左侧边栏 */
#sidebar {
    width: 250px;
    background-color: #1a1a1a;
    border-right: 2px solid #333;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
}

.sidebar-section {
    padding: 1rem;
    border-bottom: 2px solid #333;
}

.sidebar-section h3 {
    margin-bottom: 1rem;
    color: #ff4d4d;
    text-shadow: 1px 1px 0 #000;
}

.tree-item,
.component-item {
    padding: 0.5rem;
    cursor: pointer;
    transition: all 0.3s ease;
    border-left: 3px solid transparent;
}

.tree-item:hover,
.component-item:hover {
    background-color: #333;
    border-left: 3px solid #ff4d4d;
}

/* 中央编辑区域 */
#editor-canvas-container {
    flex: 1;
    background-color: #2a2a2a;
    position: relative;
    overflow: hidden;
}

.canvas-controls {
    position: absolute;
    top: 10px;
    right: 10px;
    z-index: 10;
    background-color: #1a1a1a;
    border: 2px solid #333;
    padding: 0.5rem;
}

.canvas-controls button {
    width: 30px;
    height: 30px;
    margin: 0 5px;
    background-color: #333;
    border: 1px solid #555;
    color: #fff;
    cursor: pointer;
    transition: all 0.3s ease;
}

.canvas-controls button:hover {
    background-color: #555;
    border-color: #ff4d4d;
}

#editor-canvas-wrapper {
    width: 100%;
    height: 100%;
    overflow: hidden;
}

#editor-canvas {
    background-color: #2a2a2a;
}

/* 节点样式 */
.node {
    cursor: pointer;
    transition: all 0.2s ease;
}

.node rect {
    fill: #1a1a1a;
    stroke: #333;
    stroke-width: 2px;
    rx: 5px;
    ry: 5px;
}

.node:hover rect {
    stroke: #666;
    stroke-width: 3px;
}

.node.selected rect {
    stroke: #ff4d4d;
    stroke-width: 3px;
    filter: drop-shadow(0 0 5px rgba(255, 77, 77, 0.5));
}

.node text {
    fill: #fff;
    font-size: 12px;
    text-anchor: middle;
    dominant-baseline: middle;
    pointer-events: none;
    user-select: none;
}

/* 多选模式样式 */
body.multi-select-mode {
    cursor: crosshair;
}

body.multi-select-mode .node {
    cursor: crosshair;
}

body.multi-select-mode .node:hover rect {
    stroke: #ff6b6b;
    stroke-width: 2px;
}

body.multi-select-mode .node.selected rect {
    stroke: #ff6b6b;
    stroke-width: 3px;
    filter: drop-shadow(0 0 5px rgba(255, 107, 107, 0.5));
}

/* 连接线样式 */
.connection {
    stroke: #888;
    stroke-width: 2px;
    fill: none;
}

.connection-arrow {
    fill: #888;
}

/* 右侧属性面板 */
#properties-panel {
    width: 300px;
    background-color: #1a1a1a;
    border-left: 2px solid #333;
    padding: 1rem;
    overflow-y: auto;
}

#properties-panel h3 {
    margin-bottom: 1rem;
    color: #ff4d4d;
    text-shadow: 1px 1px 0 #000;
}

.property-group {
    margin-bottom: 1rem;
}

.property-group label {
    display: block;
    margin-bottom: 0.5rem;
    color: #aaa;
}

.property-group input,
.property-group select,
.property-group textarea {
    width: 100%;
    padding: 0.5rem;
    background-color: #333;
    border: 1px solid #555;
    color: #fff;
    font-family: 'mplus_hzk_12', 'Press Start 2P', cursive;
}

.property-group textarea {
    min-height: 100px;
    resize: vertical;
}

.property-group button,
#save-node-properties {
    padding: 0.5rem 1rem;
    background-color: #333;
    border: 2px solid #555;
    color: #fff;
    cursor: pointer;
    transition: all 0.3s ease;
    margin-top: 0.5rem;
}

.property-group button:hover,
#save-node-properties:hover {
    background-color: #555;
    border-color: #ff4d4d;
}

.properties-placeholder {
    display: flex;
    justify-content: center;
    align-items: center;
    height: 100%;
    color: #555;
}

/* 模态窗口 */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.7);
    z-index: 1000;
    display: flex;
    justify-content: center;
    align-items: center;
}

.modal-content {
    background-color: #1a1a1a;
    border: 2px solid #333;
    width: 500px;
    max-width: 90%;
    max-height: 90%;
    overflow-y: auto;
}

.close-modal {
    float: right;
    font-size: 1.5rem;
    font-weight: bold;
    cursor: pointer;
    padding: 0 1rem;
    color: #fff;
}

.close-modal:hover {
    color: #ff4d4d;
}

#modal-body {
    padding: 1rem;
}

.hidden {
    display: none;
}

/* 滚动条样式 */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: #1a1a1a;
}

::-webkit-scrollbar-thumb {
    background: #333;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: #555;
}

/* 右键菜单 */
.context-menu {
    position: fixed;
    background-color: #1a1a1a;
    border: 2px solid #333;
    border-radius: 5px;
    padding: 5px 0;
    z-index: 1000;
    min-width: 150px;
}

.context-menu ul {
    list-style: none;
    margin: 0;
    padding: 0;
}

.context-menu li {
    padding: 8px 15px;
    cursor: pointer;
    color: #fff;
    transition: all 0.3s ease;
}

.context-menu li:hover {
    background-color: #333;
    color: #ff4d4d;
}
